#define _CRT_SECURE_NO_WARNINGS 1

#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
  struct ListNode {
      int val;
      struct ListNode *next;
 };
 



bool isPalindrome(struct ListNode* head) {
    if (head == NULL)
    {
        return NULL;
    }
    struct ListNode* q = head;
    struct ListNode* t = head;
    int i = 1;
    while (t->next)
    {
        t = t->next;
        i++;
    }
    i = i / 2;
    while (i)
    {
        if (q->val != t->val)
        {
            return false;
            //printf("nonono\n");
        }
        else
        {
            q = q->next;
            struct ListNode* m = head;
            int i = 1;
            while (i)
            {
                if (m->next == t)
                {
                    break;
                }
                m = m->next;
            }
            t = m;
        }
        i--;
    }
    //printf("yes");
    return true;
}
int main()
{
    struct ListNode x;
    struct ListNode y;
    struct ListNode w;
    struct ListNode z;
    x.next= &y;
    y.next =&w;
    w.next = &z;
   z .next =NULL;
    x.val = 1;
    y.val = 2;
    w.val = 2;
    z.val = 1;
    isPalindrome(&x);
}